<!DOCTYPE html> 
<html class="ui-mobile-rendering"> 
	
<head> 


     <!--Geolocation---------------------------------// -->
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
    <script type="text/javascript">
		var center;
		var map = null;
		var marker = null;

		function Newinitialize(lat,lng) {
		center = new google.maps.LatLng(lat,lng);
		var myOptions = {
			zoom: 18,	
			center: center,
			mapTypeId: google.maps.MapTypeId.ROADMAP
		}
		var new_lat1 = center.lat();
		var new_longi1 = center.lng();
		map = new google.maps.Map(document.getElementById("map_canvasRoast"), myOptions);

		marker = new google.maps.Marker({
		position: center,
		map: map,
		animation: google.maps.Animation.DROP
		});
		google.maps.event.addListener(map, 'click', function(event) {placeMarker(event.latLng);});
		google.maps.event.addListener(marker, 'click', function() {window.location.href = "./index.php/hello_controller/create_or_lucky?lat="+new_lat1+"&longi="+new_longi1;} );


		}

		function placeMarker(location) {
    		var clickedLocation = new google.maps.LatLng(location);
    		if(marker){
				marker.setMap(null);
			}
			marker = new google.maps.Marker({
			position: location, 
			map: map,
			animation: google.maps.Animation.DROP
		});
	
		var new_lat = location.lat();
		var new_longi = location.lng();
	  	google.maps.event.addListener(marker, 'click', function() {window.location.href = "./index.php/hello_controller/create_or_lucky?lat="+new_lat+"&longi="+new_longi;} );
  //map.setCenter(center);

		};

		function detectBrowser() {
			var useragent = navigator.userAgent;
			var mapdivMap = document.getElementById("map_canvasRoast");

			if (useragent.indexOf('iPhone') != -1 || useragent.indexOf('Android') != -1 ) {
				mapdivMap.style.width = '100%';
				mapdivMap.style.height = '100%';
			} 
			else {
				mapdivMap.style.width = '600px';
				mapdivMap.style.height = '800px';
			}
		};

	$(document).ready(function() {
  	$('.goMap').live('click', function() {
                                   //alert("fired");
	if(navigator.geolocation){
		detectBrowser();

		navigator.geolocation.getCurrentPosition(function(position){
		Newinitialize(position.coords.latitude,position.coords.longitude);
	});
	}
	else
	{
		detectBrowser();
		Newinitialize(52.636161,-1.133065);
	}
	});
	});
	</script>
	
	
	<title>Hellogue</title> 
	<meta name="viewport" content="width=device-width, initial-scale=1"> 
	<meta name="viewport" content="width=device-width, user-scalable=no" />
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<link rel="stylesheet" href="<?echo base_url('themes/jquery.mobile.structure-1.0.1.min.css');?>" />
    <link rel="stylesheet" href="<?echo base_url('themes/hellogue.min.css');?>" />
    <link rel="stylesheet" href="<?echo base_url('themes/jquery.mobile.scrollview.css');?>" />
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
    <script src="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.js"></script>
    <script src="<?echo base_url('themes/jquery.easing.1.3.js');?>"></script>
        
        
          <link rel="stylesheet" href="http://dev.jtsage.com/cdn/datebox/1.0.1/jquery.mobile.datebox-1.0.1.css" /> 

  <script src="http://dev.jtsage.com/cdn/datebox/1.0.1/jquery.mobile.datebox-1.0.1.js"></script>
  <script src="<?echo base_url('themes/jquery.mobile.scrollview.js');?>"></script>
  <script src="<?echo base_url('themes/scrollview.js');?>"></script>
  <?php if (false) :?>
  
        <script src="<?echo base_url('themes/jquery.mobile.iscroll.js');?>"></script>
        <script src="http://cubiq.org/dropbox/iscroll/iscroll.js?v3.7.1"></script>
	
	<?php endif;?>
	
	
	
	<script>
	function animate(){ 
 $('.splash').fadeIn('slow');}
      </script>
      
      
      
	</head> 
<body onLoad="animate()">
<?php $is_logged_in = $this->session->userdata('is_logged_in');?>
<?php if(isset($is_logged_in) && $is_logged_in):?>
<script>


$(function() {
  setTimeout(hideSplash, 2000);
});

function hideSplash() {
  $.mobile.changePage("<?=site_url('feed_controller');?>", "fade");
}
</script>
<?php else : ?>
<script>


$(function() {
  setTimeout(hideSplash, 2000);
});

function hideSplash() {
  $.mobile.changePage("<?=site_url('user_controller');?>", "fade");
}
</script>
<?php endif; ?>

<div data-role="page" id="splash" data-theme="a"> 
    <div class="splash" hidden="true">
      <center><img style="margin-top:10%;" src="<?=base_url();?>themes/resources/logo.png"/></center>
    </div>
</div>

</body>
